import http from "@/api";

import { ModuleFlexJobUrl } from "..";
import {
    FlexJobApplyVo,
    FlexJobEntity,
    FlexJobProcessVo,
    FlexJobVo,
    FlexJobGuaranteeVo
} from "@/biz/interface/FlexjobType";
import { ResPage } from "@/api/interface";

const moduleUrl = ModuleFlexJobUrl;

// * 获取订单表列表
export const getFlexJobsVoListApi = (params: {}) => {
    return http.post<ResPage<FlexJobVo>>(moduleUrl + `/job/applyjobs`, params);
};

export const getFlexjobsCntApi = (param: {}) => {
    return http.post(moduleUrl + `/job/applyjobscnt`, param);
};

// * 审核通过
export const auditJobPassByAdmin = (param: { id: string }) => {
    return http.post(moduleUrl + `/job/jobaduitp`, param);
};

// * 审核不通过
export const auditJobFailedByAdmin = (param: { id: string; aduitContent: string }) => {
    return http.post(moduleUrl + `/job/jobaduitf`, param);
};

// * 详情接口
export const getFlexJobInfoApi = (params: { id: string }) => {
    return http.post<FlexJobEntity>(moduleUrl + `/job/jobinfo`, params);
};

// * 配置岗位的收费和代扣税
export const configJobFeeTaxApi = (params: {}) => {
    return http.post(moduleUrl + `/job/jobcfgft`, params);
};

// * 获取岗位申请人信息
export const getWorkerApplyVoListApi = (params: {}) => {
    return http.post<ResPage<FlexJobApplyVo>>(moduleUrl + `/jobapi/jobapplyusers`, params);
};

export const getJobProcessesApi = (params: {}) => {
    return http.post<ResPage<FlexJobProcessVo>>(moduleUrl + `/job/jobprocess`, params);
};

export const getJobGuaranteeApi = (params: {}) => {
    return http.post<ResPage<FlexJobGuaranteeVo>>(moduleUrl + `/job/jobguarantee`, params);
};

export const getJobDoneInfoApi = (params: { id: string }) => {
    return http.post(moduleUrl + `/jobapi/jobapplydoneinfo`, params);
};

// * 删除一条申请记录
export const deleteWorkerApplyApi = (params: { id: string }) => {
    return http.post(moduleUrl + `/job/rmjobapplyitem`, params);
};
